package GUI;

import Logica.Pen;

import java.awt.Rectangle;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;

public class ModificarJaula extends JFrame {
  private JScrollPane jScrollPane1 = new JScrollPane();
  private JFormattedTextField jFormattedTextField1 = new JFormattedTextField();
  private JFormattedTextField jFormattedTextField2 = new JFormattedTextField();
  private JFormattedTextField jFormattedTextField3 = new JFormattedTextField();
  private JLabel jLabel1 = new JLabel();
  private JLabel jLabel2 = new JLabel();
  private JLabel jLabel3 = new JLabel();
  private JButton jButton1 = new JButton();
Pen pen = new Pen();
  Object[] info = new Object[8];
  public ModificarJaula(Object []info) {
    try {
      this.info = info; 
      jbInit(info);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit(Object []info) throws Exception {
    this.getContentPane().setLayout( null );
    jFormattedTextField1.setText(String.valueOf(info[1]));
    jFormattedTextField1.setBounds(new Rectangle(110, 50, 190, 25));

    jFormattedTextField2.setText(String.valueOf(info[3]));
    jFormattedTextField2.setBounds(new Rectangle(110, 150, 190, 25));

    jFormattedTextField3.setText(String.valueOf(info[2]));
    jFormattedTextField3.setBounds(new Rectangle(110, 100, 190, 25));
    jLabel1.setText("Capacidad");
    jLabel1.setBounds(new Rectangle(15, 50, 75, 25));
    jLabel2.setText("Estado");
    jLabel2.setBounds(new Rectangle(15, 100, 75, 25));
    jLabel3.setText("Clinic Number");
    jLabel3.setBounds(new Rectangle(15, 150, 75, 25));
    jButton1.setText("Guardar");
    jButton1.setBounds(new Rectangle(265, 205, 100, 40));
    jButton1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          jButton1_actionPerformed(e);
        }
      });
    this.getContentPane().add(jButton1, null);
    this.getContentPane().add(jLabel3, null);
    this.getContentPane().add(jLabel2, null);
    this.getContentPane().add(jLabel1, null);
    this.getContentPane().add(jFormattedTextField3, null);
    this.getContentPane().add(jFormattedTextField2, null);
    this.getContentPane().add(jFormattedTextField1, null);
    this.getContentPane().add(jScrollPane1, null);
    this.setSize(500, 500);

  }

  private void jButton1_actionPerformed(ActionEvent e) 
  {
    pen.modificaClinicPen(String.valueOf(info[0]), this.jFormattedTextField2.getText().toString());
    pen.modificaPenCapacity(String.valueOf(info[0]), this.jFormattedTextField1.getText().toString());
    pen.modificaStatusPen(String.valueOf(info[0]), this.jFormattedTextField3.getText().toString());
  }
}
